package xc;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class demo6 {
    public static class tread implements Runnable{
        public void run() {
            for (int i = 0; i < 50; i++)
                System.out.println(Thread.currentThread().getName() + "------");
        }
    }

    public static void main(String[] args) {

        ExecutorService pool1 = Executors.newCachedThreadPool();
        //表示最大为3个线程
        //ExecutorService pool2 = Executors.newFixedThreadPool(3);

//        pool1.submit(new tread());
//        pool1.submit(new tread());
//        pool1.submit(new tread());
        //System.out.println(Runtime.getRuntime().availableProcessors());
        //线程数
        pool1.shutdown();

    }
}
